import java.util.ArrayList;
import java.util.Scanner;


public class Alpha_Compare {
	public static void main (String args[]){

		Scanner in = new Scanner (System.in);
	
		ArrayList <String> x= new ArrayList <String>();
	
		String s= "";
		int y;
		System.out.println("How many words are you inputing?");
		y=in.nextInt();
	
	for(int i=0; i<y; i++) {
	
		System.out.println("What is the word?");
		s=in.next();
		
		x.add(s); 
	}
			String temp;
	for(int i=0; i<x.size(); i++) {
		for(int j=i; j<x.size(); j++)
			if(x.get(i).compareToIgnoreCase(x.get(j)) > 0) {
				
				temp=x.get(i);
				x.set(i,x.get(j));
				x.set(j, temp);
				
				
		}
	}
			for(int i=0; i<x.size(); i++) {
				
				System.out.println(x.get(i).substring(3,4));
		
		
		
	}
}
}
